

using System;
using System.Text;

using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Exceptions;

using NuevoGenNHibernate.EN.Ebay;
using NuevoGenNHibernate.CAD.Ebay;

namespace NuevoGenNHibernate.CEN.Ebay
{
public partial class LineaVentaCEN
{
private ILineaVentaCAD _ILineaVentaCAD;

public LineaVentaCEN(ILineaVentaCAD _ILineaVentaCAD)
{
        this._ILineaVentaCAD = _ILineaVentaCAD;
}

public ILineaVentaCAD get_ILineaVentaCAD ()
{
        return this._ILineaVentaCAD;
}

public int CrearLineaVenta (int p_Numero, int p_Cantidad, int p_compraloYA, int p_articulos)
{
        LineaVentaEN lineaVentaEN = null;
        int oid;

        //Initialized LineaVentaEN
        lineaVentaEN = new LineaVentaEN ();
        lineaVentaEN.Numero = p_Numero;

        lineaVentaEN.Cantidad = p_Cantidad;


        if (p_compraloYA != -1) {
                lineaVentaEN.CompraloYA = new NuevoGenNHibernate.EN.Ebay.VentaEN ();
                lineaVentaEN.CompraloYA.Id_venta = p_compraloYA;
        }


        if (p_articulos != -1) {
                lineaVentaEN.Articulos = new NuevoGenNHibernate.EN.Ebay.ArticuloEN ();
                lineaVentaEN.Articulos.Id_articulo = p_articulos;
        }

        //Call to LineaVentaCAD

        oid = _ILineaVentaCAD.CrearLineaVenta (lineaVentaEN);
        return oid;
}

public void ModificarLineaVenta (int p_LineaVenta_OID, int p_Numero, int p_Cantidad)
{
        LineaVentaEN lineaVentaEN = null;

        //Initialized LineaVentaEN
        lineaVentaEN = new LineaVentaEN ();
        lineaVentaEN.Id_lineaVenta = p_LineaVenta_OID;
        lineaVentaEN.Numero = p_Numero;
        lineaVentaEN.Cantidad = p_Cantidad;
        //Call to LineaVentaCAD

        _ILineaVentaCAD.ModificarLineaVenta (lineaVentaEN);
}

public void EliminarLineaVenta (int id_lineaVenta)
{
        _ILineaVentaCAD.EliminarLineaVenta (id_lineaVenta);
}

public LineaVentaEN ReadOID (int id_lineaVenta)
{
        LineaVentaEN lineaVentaEN = null;

        lineaVentaEN = _ILineaVentaCAD.ReadOID (id_lineaVenta);
        return lineaVentaEN;
}

public System.Collections.Generic.IList<LineaVentaEN> ReadAll (int first, int size)
{
        System.Collections.Generic.IList<LineaVentaEN> list = null;

        list = _ILineaVentaCAD.ReadAll (first, size);
        return list;
}
}
}
